import {request} from "@/common/request";
import {IResponse} from "@/common/common";

export interface IApiLogin {
  username: string;
  password: string;
}

export async function apiLogin(data: any) {
  return request({url: "/v1/api/blog/auth/login", method: "POST", data});
}

export async function apiRegister(data: any) {
  return request({url: "/v1/api/blog/auth/register", method: "POST", data});
}

export async function apiUpdateUserInfo(data: any) {
  return request({url: "/v1/api/blog/user/update", method: "PUT", data});
}

export async function apiModifyUserAvatar(formData: any) {
  return request({
    url: "/v1/api/blog/user/avatar",
    method: "POST",
    data: formData,
    headers: {'content-type': 'multipart/form-data'}
  })
}

export async function apiGetUserInfo() {
  return request({url: "/v1/api/blog/user/info", method: "GET"})
}

export async function apiLogout() {
  return request({url: "/v1/api/blog/auth/logout", method: "GET"})
}
